import bpy;

depths = ["inner", "outer", "fill"]
sides = ["diagonal", "diagonal2", "diagonal3", "diagonal4", "horizontal", "vertical"]	
path = bpy.data.scenes[0].render.filepath

def show(name, value):
   try:		
      bpy.data.objects[name].hide_render = not(value);
   except KeyError:
      pass
   
def showAll(value):
   for depth in depths:
      for side in sides:
         show(depth + "." + side, value)

def _render():
   showAll(False);
   for depth in depths:
      for side in sides:
         try:
            'Rendering ' + depth + '.' + side + '...'
            show(depth + "." + side, True)
            bpy.context.scene.render.use_compositing = not(bpy.context.object.get('no_lines') == 1)
            orientation = bpy.context.scene.get('orientation')
            if orientation == 'hanging':
               orientation = ',h'
            else:
               orientation = ',t'
            orientation = orientation + "," + str(bpy.context.scene.get('tile.width'))   
            orientation = orientation + "," + str(bpy.context.scene.get('tile.height'))   
            strPath = path + orientation + "." + depth + "." + side
            bpy.data.scenes[0].render.filepath = strPath
            bpy.ops.render.render(write_still=True)
            bpy.data.scenes[0].render.filepath = path
            strPath = ""
            show(depth + "." + side, False)
         except KeyError:
            pass
      
_render()
